class Result
  include Mongoid::Document
  include Mongoid::Timestamps

  default_scope ->{ desc(:created_at) }

  belongs_to :task

  field :sample1_id, type: String
  field :sample2_id, type: String
  field :finger1_id, type: String
  field :finger2_id, type: String

  VALID_MARKER = ['pending', 'yes', 'no']
  field :marker, type: String, default: 'pending'
  VALID_MARKER.each do |m|
    scope m.to_sym, ->{ where(marker: m) }
  end

  def sample1
    Sample.find(sample1_id)
  end

  def sample2
    Sample.find(sample2_id)
  end
end
